package com.sansan.ultrasound_handpad.adaptor.brvah;

import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.Toast;

import androidx.appcompat.widget.AppCompatCheckBox;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView;
import com.sansan.ultrasound_handpad.R;
import com.sansan.ultrasound_handpad.entity.PcbTaskPositionRecord;
import com.sansan.ultrasound_handpad.entity.PcbTaskPositionRecordDetail;

import org.jetbrains.annotations.NotNull;

public class PcbTaskPositionRecordAdapter extends BaseQuickAdapter<PcbTaskPositionRecordDetail, BaseViewHolder> {

    public PcbTaskPositionRecordAdapter() {
        super(R.layout.pcb_taskposition_record_rv_item);
//        addChildClickViewIds(R.id.pcb_taskposition_record_rv_item_cb);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, PcbTaskPositionRecordDetail item) {
        if (item != null) {
            holder.setText(R.id.pcb_taskposition_record_rv_item_numTv, item.getPosition());
            holder.setText(R.id.pcb_taskposition_record_rv_item_nameTv, item.getProduct_code());

            holder.setText(R.id.pcb_taskposition_record_rv_item_nameEle,item.getElement_name());
            AppCompatCheckBox cb = (AppCompatCheckBox) holder.getView(R.id.pcb_taskposition_record_rv_item_cb);
            cb.setChecked("2".equals(item.getInstall_status()));
            if (!"2".equals(item.getInstall_status())){
                cb.setChecked(false);
            }
        }
    }
}
